//
// Created by 11510 on 2025/10/3.
//

#pragma once
#include <tinyxml2.h>
#include <string>
#include <unordered_map>
#include <optional>
#include <stdexcept>
#include <sstream>
#include <cctype>

class TinyXmlRegisterTPMap {
public:
    struct RegInfo {
        std::string category;
        std::string name;
        uint16_t address;
        uint16_t numOfReg;
        std::string tooltip;
        std::string description;
    };

    explicit TinyXmlRegisterTPMap(const std::string& xmlPath) ;

    std::optional<uint16_t> getAddress(const std::string& category, const std::string& name) const ;
    std::optional<uint16_t> getNumOfReg(const std::string& category, const std::string& name) const ;
private:
    tinyxml2::XMLDocument doc;
    std::unordered_map<uint64_t, std::vector<RegInfo>> map;
};
